In [8]:
import random
def bubblesort(input_array):
length = len(input_array)
for i in range(length):
for j in range(length - 1):
if input_array[j] > input_array[j + 1]:
input_array[j], input_array[j + 1] = input_array[j + 1], input_array[j]
return input_array
bubblesort([random.random() for i in range(10)])
Out[8]: